package olga.gorbatiuk.record.comparators;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.math.BigDecimal;
import java.util.Date;

import olga.gorbatiuk.record.Record;

import org.junit.Test;

public class ByDateComparatorTest {

    @Test
    public void testCompare_FirstDatePrecedesSecond_NegativeInteger() {
	Date date1 = new Date(2014, 06, 11);
	Date date2 = new Date(2015, 10, 12);
	Record record1 = new Record(date1, null, null, null);
	Record record2 = new Record(date2, null, null, null);
	int result = new ByDateComparator().compare(record1, record2);

	assertTrue(result < 0);
    }

    @Test
    public void testCompare_FirstDateFollowsSecond_PositiveInteger() {
	Date date1 = new Date(2015, 10, 12);
	Date date2 = new Date(2014, 06, 11);
	Record record1 = new Record(date1, null, null, null);
	Record record2 = new Record(date2, null, null, null);
	int result = new ByDateComparator().compare(record1, record2);

	assertTrue(result > 0);
    }

    @Test
    public void testCompare_FirstDateEqualsSecond_Zero() {
	Date date1 = new Date(2015, 10, 12);
	Date date2 = new Date(2015, 10, 12);
	Record record1 = new Record(date1, null, null, null);
	Record record2 = new Record(date2, null, null, null);
	int result = new ByDateComparator().compare(record1, record2);

	assertTrue(result == 0);
    }
}
